{namespace Bird.soy}

/**
 * This is a Closure Template.
 *
 * To regenerate just English, run:
 *   make bird-en
 *
 * To regenerate all languages, run:
 *   make languages
 */

/**
 * Translated messages for use in JavaScript.
 */
{template .messages}
  {call BlocklyGames.soy.messages /}
  <div style="display: none">
    <span id="Bird_noWorm">{msg meaning="Bird.noWorm" desc="block text - Bird is not in possession of a worm.  This phrase is prefixed with 'if'."}does not have worm{/msg}</span>
    <span id="Bird_heading">{{msg meaning="Bird.heading" desc="block text - the compass direction toward which a traveler or vehicle is or should be moving; course.\n{lb}{lb}Identical|Heading{rb}{rb}"}}heading{{/msg}}</span>
    <span id="Bird_noWormTooltip">{msg meaning="Bird.noWormTooltip" desc="tooltip - The bird wants to get the worm."}The condition when the bird has not gotten the worm.{/msg}</span>
    <span id="Bird_headingTooltip">{msg meaning="Bird.headingTooltip" desc="tooltip - Move in the direction of the given angle, where 0 means going horizontally to the right, and 90 straight up and 270 straight down."}Move in the direction of the given angle: 0 is to the right, 90 is straight up, etc.{/msg}</span>
    <span id="Bird_positionTooltip">{msg meaning="Bird.positionTooltip" desc="tooltip - (x, y) marks the coordinate of bird, (0, 0) is the bottom left corner and (100, 100) top right."}x and y mark the bird's position. When x = 0 the bird is near the left edge, when x = 100 it's near the right edge. When y = 0 the bird is at the bottom, when y = 100 it's at the top.{/msg}</span>
  </div>
{/template}

/**
 * Web page structure.
 */
{template .start}
  {call .messages /}
  <table width="100%">
    <tr>
      <td>
        <h1>
          {call BlocklyGames.soy.titleSpan}
            {param appName}
              {msg meaning="Games.bird" desc="IBID"}Bird{/msg}
            {/param}
          {/call}
          {call BlocklyGames.soy.levelLinks}
            {param level: $ij.level /}
            {param maxLevel: $ij.maxLevel /}
            {param lang: $ij.lang /}
            {param suffix}{/param}
          {/call}
        </h1>
      </td>
      <td class="farSide">
        <select id="languageMenu"></select>
        &nbsp;
        <button id="linkButton" title="{msg meaning="Games.linkTooltip" desc="IBID"}Save and link to blocks.{/msg}">
          <img src="common/1x1.gif" class="link icon21">
        </button>
      </td>
    </tr>
  </table>

  <div id="visualization">
    <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="svgBird" width="400px" height="400px">
    </svg>
  </div>

  <table width="400">
    <tr>
      <td style="width: 190px;">
      </td>
      <td>
        <button id="runButton" class="primary" title="{msg meaning="Games.runTooltip" desc="IBID"}Run the program you wrote.{/msg}">
          <img src="common/1x1.gif" class="run icon21"> {msg meaning="Games.runProgram" desc="IBID"}Run Program{/msg}
        </button>
        <button id="resetButton" class="primary" style="display: none" title="{msg meaning="Games.resetTooltip" desc="IBID"}Stop the program and reset the level.{/msg}">
          <img src="common/1x1.gif" class="stop icon21"> {msg meaning="Games.resetProgram" desc="IBID"}Reset{/msg}
        </button>
      </td>
    </tr>
  </table>

  {call .toolbox /}
  <div id="blockly"></div>

  {call BlocklyGames.soy.dialog /}
  {call BlocklyGames.soy.doneDialog /}
  {call BlocklyGames.soy.abortDialog /}
  {call BlocklyGames.soy.storageDialog /}

  <div id="dialogHelp" class="dialogHiddenContent">
    {if $ij.level == 1}
      <table><tr><td rowspan=2>
        <img src="common/help.png">
      </td><td>
        <div class="farSide"><img src="bird/help_heading.png" class="mirrorImg" height=27 width=141></div>
      </td></tr><tr><td>
        {msg meaning="Bird.helpHeading" desc="callout - This is shown as instruction for the first level."}
          Change the heading angle to make the bird get the worm and land in her nest.
        {/msg}
      </td></tr></table>
    {elseif $ij.level == 2}
      <table><tr><td>
        <img src="common/help.png">
      </td><td>
        {msg meaning="Bird.helpHasWorm" desc="callout - This is shown when the 'does not have worm' block is introduced."}
          Use this block to go in one heading if you have the worm, or a different heading if you don't have the worm.
        {/msg}
      </td><td>
        <img src="bird/help_up.png">
      </td></tr></table>
    {elseif $ij.level == 4}
      <table><tr><td>
        <img src="common/help.png">
      </td><td>
        {msg meaning="Bird.helpX" desc="callout - This is shown when the 'x smaller than 50' block is introduced."}
          'x' is your current horizontal position. Use this block to go in one heading if 'x' is less than a number, or a different heading otherwise.
        {/msg}
      </td><td>
        <img src="bird/help_up.png">
      </td></tr></table>
    {elseif $ij.level == 5}
      <table><tr><td>
        <img src="bird/help_up.png">
      </td><td>
        {msg meaning="Bird.helpElse" desc="callout - This is shown when the user first needs to modify an 'if' block."}
          Click the icon to modify the 'if' block.
        {/msg}
      </td><td>
        <img src="common/help.png">
      </td></tr></table>
    {elseif $ij.level == 6}
      <table><tr><td>
        <img src="bird/help_up.png">
      </td><td>
        {{msg meaning="Bird.helpElseIf" desc="callout - This is shown when the user first needs to modify an 'if' block to have an 'else if' and an 'else'.\n\nMake sure to translate consistently with:\n* {lb}{lb}msg-blockly|CONTROLS IF MSG ELSEIF{rb}{rb}\n* {lb}{lb}msg-blockly|CONTROLS IF MSG ELSE{rb}{rb}"}}
          This level needs both an 'else if' and an 'else' block.
        {{/msg}}
      </td><td>
        <img src="common/help.png">
      </td></tr></table>
    {elseif $ij.level == 8}
      <table><tr><td>
        <img src="bird/help_up.png">
      </td><td>
        {{msg meaning="Bird.helpAnd" desc="callout - This is shown to introduce the user to the logical 'and' block.\n\nMake sure to translate consistently with:\n* {lb}{lb}msg-blockly|LOGIC OPERATION AND{rb}{rb}"}}
          The 'and' block is true only if both its inputs are true.
        {{/msg}}
      </td><td>
        <img src="common/help.png">
      </td></tr></table>
    {/if}
  </div>
  {if $ij.level == 5}
    <div id="dialogMutatorHelp" class="dialogHiddenContent">
      <table><tr><td>
        <img src="bird/help_mutator.png" class="mirrorImg" height=58 width=107>
      </td><td>
        {{msg meaning="Bird.helpMutator" desc="callout - This is shown to demonstrate how to drag a block.\n\nTranslate consistently with:\n* {lb}{lb}msg-blockly|CONTROLS IF MSG ELSE{rb}{rb}\n* {lb}{lb}msg-blockly|CONTROLS IF MSG IF{rb}{rb}"}}
          Drag an 'else' block into the 'if' block.
        {{/msg}}
      </td></tr></table>
    </div>
  {/if}
{/template}

/**
 * Toolboxes for each level.
 */
{template .toolbox}
  <xml id="toolbox" xmlns="https://developers.google.com/blockly/xml">
    <block type="bird_heading"></block>
    {if $ij.level >= 2}
      {if $ij.level == 4 or $ij.level == 5}
        <block type="bird_noWorm" disabled="true"></block>
      {else}
        <block type="bird_noWorm"></block>
      {/if}
      {if $ij.level >= 4}
        <block type="bird_compare">
          <field name="OP">LT</field>
          <value name="A">
            <block type="bird_position" movable="false">
              <field name="XY">X</field>
            </block>
          </value>
          <value name="B">
            <block type="math_number" movable="false">
              <field name="NUM">50</field>
            </block>
          </value>
        </block>
        {if $ij.level >= 5}
          <block type="bird_compare">
            <field name="OP">LT</field>
            <value name="A">
              <block type="bird_position" movable="false">
                <field name="XY">Y</field>
              </block>
            </value>
            <value name="B">
              <block type="math_number" movable="false">
                <field name="NUM">50</field>
              </block>
            </value>
          </block>
          {if $ij.level >= 8}
            <block type="bird_and"></block>
          {/if}
        {/if}
      {/if}
    {/if}
  </xml>
{/template}
